//
//  main.m
//  02-FracHomeWork
//
//  Created by 曹曹 on 16/7/5.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Fraction.h"
int main(int argc, const char * argv[]) {
    Fraction *frac1 = [Fraction fractionWithNumerator:1 denominator:2];
    Fraction *frac2 = [Fraction fractionWithNumerator:3 denominator:4];
    Fraction *frac3 = [Fraction fractionWithNumerator:3 denominator:57];
    Fraction *plus = [frac1 plusWithFraction:frac2];
    Fraction *decrease = [frac1 decreaseWithFraction:frac2];
    Fraction *multiple = [frac1 multipleWithFraction:frac2];
    Fraction *divide = [frac1 divideWithFraction:frac2];
    Fraction *reduction = [frac3 reduction];
    if (plus.demoninator == 0 || decrease.demoninator == 0 || multiple.demoninator == 0 || divide.demoninator == 0) {
        NSLog(@"分母不能为0");
    } else {
        NSLog(@"plus:%ld/%ld", plus.numerator, plus.demoninator);
        NSLog(@"decrease:%ld/%ld", decrease.numerator, decrease.demoninator);
        NSLog(@"multiple:%ld/%ld", multiple.numerator, multiple.demoninator);
        NSLog(@"divide:%ld/%ld", divide.numerator, divide.demoninator);
        NSLog(@"reduction:%ld/%ld", reduction.numerator, reduction.demoninator);
    }
    [frac1 compareWithFraction:frac2];
    return 0;
}
